import Vue from 'vue'
import App from './App.vue'
// 引入路由
import router from '@/router'
// 引入vuex store
import store from '@/store'
// 注册全局组件
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/pagination'
import { Button, MessageBox, Message } from 'element-ui'
Vue.component('TypeNav', TypeNav)
Vue.component('Carousel', Carousel)
Vue.component('Pagination', Pagination)
Vue.component(Button.name, Button)
//ElementUI注册组件的时候，还有一种写法，挂在原型上
Vue.prototype.$msgbox = MessageBox
Vue.prototype.$alert = MessageBox.alert
Vue.prototype.$message = Message
// 引入MockServe.js --mock数据
import '@/mock/mockServe'
// 引入swiper轮播图
import 'swiper/css/swiper.css'
//统一接口api文件夹里面全部请求函数
//统一引入
import * as API from '@/api';
import atm from '@/assets/1.gif'
//引入插件
import VueLazyload from 'vue-lazyload'
//注册插件
Vue.use(VueLazyload, {
  //懒加载默认的图片
  loading: atm
})
//引入表单校验插件
import "@/plugins/validate";
Vue.config.productionTip = false

new Vue({
  render: (h) => h(App),
  // 注册路由
  router,
  store,
  beforeCreate () { 
    Vue.prototype.$bus = this
    Vue.prototype.$API = API
  }
}).$mount('#app')
